home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-01-19 | 50.1 KB | 1,560 lines |
- Newsgroups: comp.sources.misc
- subject: v10i015: PCcurses v.1.4 part 1 of 7
- from: bl@infovox.se (Bj|rn Larsson)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 10, Issue 15
- Submitted-by: bl@infovox.se (Bj|rn Larsson)
- Archive-name: pccurses14/part01
-
- This is version 1.4 of PCcurses (a PC version of the standard UNIX
- screen and window library called CURSES). I hope that suffices as a
- description of the contents. The file readme.now describes the
- development history. The package supports TurboC and MicroSoft C,
- but should be easy to port to any other compiler (it was in fact
- ported to a 68000 system in about a day - with limitations, of
- course).
-
- I hope the moderator does not frown too much at the last part, which
- contains an uuencoded binary of a MAKE program for DOS. It is inclu-
- ded because a decent MAKE is needed to build the package...:-(
-
- Disclaimer: There is also another CURSES-lookalike with the same name,
- maintained by Jeff Dean (parcvax,hplabs}!cdp!jeff, jeff@ads.arpa).
- The PCcurses you are looking at comes from Bjorn Larsson (bl@infovox.se).
- Just to avoid confusion.
-
- Bjorn
-
-
- # ----------------------------- cut here -----------------------------
- #! /bin/sh
- # This is a shell archive. Remove anything before the `cut' line,
- # then unpack by saving it into a file and typing `sh file'. The
- # archive ends by exit(0), so don't worry about trailing junk.
- #
- # (This is archive 1 in a series of 7).
- #
- # Contents:
- #
- # beep.c
- # bllibc.cmd
- # charpick.c
- # curses.cmd
- # curses68.cmd
- # endwin.c
- # farcall.inc
- # hugedata.inc
- # initscr.c
- # longname.c
- # MANIFEST
- # move.c
- # mvcursor.c
- # nearcall.inc
- # scrreg.c
- # smaldata.inc
- # stradd.c
- # tabsize.c
- # termmisc.c
- # unctrl.c
- # winclear.c
- # windel.c
- # winerase.c
- # winmove.c
- # winscrol.c
- # wintouch.c
- #
- # Wrapped by USER@MS-DOS --- Sun Jan 14 14:02:16 1990
- #
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f beep.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"beep.c\"
- else
- echo Extracting - \"beep.c\"
- sed "s/^X//" >beep.c <<'END_OF_beep.c'
- X/****************************************************************/
- X/* */
- X/* Beep() and flash() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_beep_rcsid[] = "@(#)beep.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Beep() sounds the terminal bell. */
- X/****************************************************************/
- X
- Xvoid beep()
- X {
- X _cursesputc('\007',0);
- X } /* beep */
- X
- X/****************************************************************/
- X/* Flash() flashes the terminal screen. */
- X/****************************************************************/
- X
- Xvoid flash()
- X {
- X short i;
- X
- X _cursesscroll(0,0,LINES-1,COLS-1,0,0x70);
- X for (i=0;i<10000;)
- X i++;
- X _cursesscroll(0,0,LINES-1,COLS-1,0,0x0);
- X wrefresh(curscr);
- X } /* flash */
- END_OF_beep.c
- if test 1589 -ne `wc -c <beep.c`; then
- echo \"beep.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f bllibc.cmd -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"bllibc.cmd\"
- else
- echo Extracting - \"bllibc.cmd\"
- sed "s/^X//" >bllibc.cmd <<'END_OF_bllibc.cmd'
- X
- X-attrib.obj &
- X-beep.obj &
- X-border.obj &
- X-boxes.obj &
- X-charadd.obj &
- X-chardel.obj &
- X-charget.obj &
- X-charins.obj &
- X-charpick.obj &
- X-clrtobot.obj &
- X-clrtoeol.obj &
- X-cursesio.obj &
- X-endwin.obj &
- X-initscr.obj &
- X-linedel.obj &
- X-lineins.obj &
- X-longname.obj &
- X-move.obj &
- X-mvcursor &
- X-newwin.obj &
- X-options.obj &
- X-overlay.obj &
- X-prntscan.obj &
- X-refresh.obj &
- X-scrreg.obj &
- X-setmode.obj &
- X-setterm.obj &
- X-stradd.obj &
- X-strget.obj &
- X-tabsize.obj &
- X-termmisc.obj &
- X-unctrl.obj &
- X-update.obj &
- X-winclear.obj &
- X-windel.obj &
- X-winerase.obj &
- X-winmove.obj &
- X-winscrol.obj &
- X-wintouch.obj &
- X+bltmp.lib
- X
- X
- X
- END_OF_bllibc.cmd
- if test 639 -ne `wc -c <bllibc.cmd`; then
- echo \"bllibc.cmd\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f charpick.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"charpick.c\"
- else
- echo Extracting - \"charpick.c\"
- sed "s/^X//" >charpick.c <<'END_OF_charpick.c'
- X/****************************************************************/
- X/* Winch() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_charpick_rcsid[] = "@(#)charpick.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Winch(win) returns the character at the current position in */
- X/* window 'win'. */
- X/****************************************************************/
- X
- Xint winch(win)
- X WINDOW *win;
- X {
- X return((win->_line[win->_cury][win->_curx]) & 0xff);
- X } /* winch */
- X
- X/****************************************************************/
- X/* Inch() returns the character at the current cursor position */
- X/* in stdscr. */
- X/****************************************************************/
- X
- Xint inch()
- X {
- X return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
- X } /* inch */
- X
- X/****************************************************************/
- X/* Mvinch() moves the stdscr cursor to a new position, then */
- X/* returns the character at that position. */
- X/****************************************************************/
- X
- Xint mvinch(y,x)
- X int y;
- X int x;
- X {
- X if (wmove(stdscr,y,x) == ERR)
- X return(ERR);
- X return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
- X } /* mvinch */
- X
- X/****************************************************************/
- X/* Mvwinch() moves the cursor of window 'win' to a new posi- */
- X/* tion, then returns the character at that position. */
- X/****************************************************************/
- X
- Xint mvwinch(win,y,x)
- X WINDOW *win;
- X int y;
- X int x;
- X {
- X if (wmove(win,y,x) == ERR)
- X return(ERR);
- X return((win->_line[win->_cury][win->_curx]) & 0xff);
- X } /* mvwinch */
- END_OF_charpick.c
- if test 2479 -ne `wc -c <charpick.c`; then
- echo \"charpick.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f curses.cmd -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"curses.cmd\"
- else
- echo Extracting - \"curses.cmd\"
- sed "s/^X//" >curses.cmd <<'END_OF_curses.cmd'
- Xtmp.lib
- Xy
- X+attrib.obj &
- X+beep.obj &
- X+border.obj &
- X+boxes.obj &
- X+charadd.obj &
- X+chardel.obj &
- X+charget.obj &
- X+charins.obj &
- X+charpick.obj &
- X+clrtobot.obj &
- X+clrtoeol.obj &
- X+cursesio.obj &
- X+endwin.obj &
- X+initscr.obj &
- X+linedel.obj &
- X+lineins.obj &
- X+longname.obj &
- X+move.obj &
- X+mvcursor &
- X+newwin.obj &
- X+options.obj &
- X+overlay.obj &
- X+prntscan.obj &
- X+refresh.obj &
- X+scrreg.obj &
- X+setmode.obj &
- X+setterm.obj &
- X+stradd.obj &
- X+strget.obj &
- X+tabsize.obj &
- X+termmisc.obj &
- X+unctrl.obj &
- X+update.obj &
- X+winclear.obj &
- X+windel.obj &
- X+winerase.obj &
- X+winmove.obj &
- X+winscrol.obj &
- X+wintouch.obj
- Xnul
- END_OF_curses.cmd
- if test 636 -ne `wc -c <curses.cmd`; then
- echo \"curses.cmd\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f curses68.cmd -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"curses68.cmd\"
- else
- echo Extracting - \"curses68.cmd\"
- sed "s/^X//" >curses68.cmd <<'END_OF_curses68.cmd'
- X ; Create new 68000 Curses library
- X ;
- XCREATE CURSES.LIB
- X ;
- XADD CURSES.LIB = ATTRIB.OBJ
- XADD CURSES.LIB = BEEP.OBJ
- XADD CURSES.LIB = BORDER.OBJ
- XADD CURSES.LIB = BOXES.OBJ
- XADD CURSES.LIB = CHARADD.OBJ
- XADD CURSES.LIB = CHARDEL.OBJ
- XADD CURSES.LIB = CHARGET.OBJ
- XADD CURSES.LIB = CHARINS.OBJ
- XADD CURSES.LIB = CHARPICK.OBJ
- XADD CURSES.LIB = CLRTOBOT.OBJ
- XADD CURSES.LIB = CLRTOEOL.OBJ
- XADD CURSES.LIB = ENDWIN.OBJ
- XADD CURSES.LIB = INITSCR.OBJ
- XADD CURSES.LIB = LINEDEL.OBJ
- XADD CURSES.LIB = LINEINS.OBJ
- XADD CURSES.LIB = LONGNAME.OBJ
- XADD CURSES.LIB = MOVE.OBJ
- XADD CURSES.LIB = MVCURSOR.OBJ
- XADD CURSES.LIB = NEWWIN.OBJ
- XADD CURSES.LIB = OPTIONS.OBJ
- XADD CURSES.LIB = OVERLAY.OBJ
- XADD CURSES.LIB = PRNTSCAN.OBJ
- XADD CURSES.LIB = REFRESH.OBJ
- XADD CURSES.LIB = SCRREG.OBJ
- XADD CURSES.LIB = SETMODE.OBJ
- XADD CURSES.LIB = SETTERM.OBJ
- XADD CURSES.LIB = STRADD.OBJ
- XADD CURSES.LIB = STRGET.OBJ
- XADD CURSES.LIB = TABSIZE.OBJ
- XADD CURSES.LIB = TERMMISC.OBJ
- XADD CURSES.LIB = UNCTRL.OBJ
- XADD CURSES.LIB = UPDATE.OBJ
- XADD CURSES.LIB = WINCLEAR.OBJ
- XADD CURSES.LIB = WINDEL.OBJ
- XADD CURSES.LIB = WINERASE.OBJ
- XADD CURSES.LIB = WINMOVE.OBJ
- XADD CURSES.LIB = WINSCROL.OBJ
- XADD CURSES.LIB = WINTOUCH.OBJ
- XADD CURSES.LIB = CURSES68.OBJ
- X ;
- XEXIT
- END_OF_curses68.cmd
- if test 1215 -ne `wc -c <curses68.cmd`; then
- echo \"curses68.cmd\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f endwin.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"endwin.c\"
- else
- echo Extracting - \"endwin.c\"
- sed "s/^X//" >endwin.c <<'END_OF_endwin.c'
- X/****************************************************************/
- X/* Endwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Changed call sequqnce to cursesio.[c,asm], Thanks */
- X/* to S. Creps. Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_endwin_rcsid[] = "@(#)endwin.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Endwin() does neccessary clean-up after using the PCcurses */
- X/* package. It should be called before exiting the user's pro- */
- X/* gram. */
- X/****************************************************************/
- X
- Xint endwin()
- X {
- X delwin(stdscr);
- X delwin(curscr);
- X delwin(_cursvar.tmpwin);
- X curson(); /* turn on cursor if off */
- X _cursescursor(LINES-1, 0); /* put at lower left */
- X _cursesscb(_cursvar.orgcbr); /* restore original ^BREAK setting */
- X return(OK);
- X } /* endwin */
- END_OF_endwin.c
- if test 1604 -ne `wc -c <endwin.c`; then
- echo \"endwin.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f farcall.inc -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"farcall.inc\"
- else
- echo Extracting - \"farcall.inc\"
- sed "s/^X//" >farcall.inc <<'END_OF_farcall.inc'
- X far_call EQU 1
- END_OF_farcall.inc
- if test 16 -ne `wc -c <farcall.inc`; then
- echo \"farcall.inc\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f hugedata.inc -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"hugedata.inc\"
- else
- echo Extracting - \"hugedata.inc\"
- sed "s/^X//" >hugedata.inc <<'END_OF_hugedata.inc'
- X huge_data EQU 1
- END_OF_hugedata.inc
- if test 17 -ne `wc -c <hugedata.inc`; then
- echo \"hugedata.inc\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f initscr.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"initscr.c\"
- else
- echo Extracting - \"initscr.c\"
- sed "s/^X//" >initscr.c <<'END_OF_initscr.c'
- X/****************************************************************/
- X/* Initscr() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.1: Revision string in the code: 880306 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_initscr_rcsid[] = "@(#)initscr.c v.1.4 - 900114";
- Xchar _curses_revcod[] = CURSES_RCS_ID;
- Xchar _curses_cpyrgt[] = "Author B. Larsson - Public Domain";
- X
- Xextern void exit(); /* to avoid warings */
- X
- XWINDOW *curscr; /* the current screen image */
- XWINDOW *stdscr; /* the default screen window */
- Xcursv _cursvar; /* curses variables */
- Xint LINES; /* terminal height */
- Xint COLS; /* terminal width */
- X
- X/****************************************************************/
- X/* Initscr() does neccessary initializations for the PCcurses */
- X/* package. It MUST be called before any other curses routines. */
- X/****************************************************************/
- X
- Xint initscr()
- X {
- X _cursvar.cursrow = -1; /* Initial cursor unknown */
- X _cursvar.curscol = -1;
- X _cursvar.autocr = TRUE; /* lf -> crlf by default */
- X _cursvar.raw = FALSE; /* tty I/O modes */
- X _cursvar.cbreak = FALSE;
- X _cursvar.echo = TRUE;
- X _cursvar.refrbrk = FALSE; /* no premature end of refresh */
- X _cursvar.orgcbr = (bool)_cursesgcb();/* original ^BREAK setting */
- X
- X LINES = 25; /* this ought to be fixed */
- X COLS = _cursesgcols();
- X
- X if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X curscr->_clear = FALSE;
- X return(OK);
- X } /* initscr */
- END_OF_initscr.c
- if test 2434 -ne `wc -c <initscr.c`; then
- echo \"initscr.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f longname.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"longname.c\"
- else
- echo Extracting - \"longname.c\"
- sed "s/^X//" >longname.c <<'END_OF_longname.c'
- X/****************************************************************/
- X/* Longname() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_longname_rcsid[] = "@(#)longname.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Longname() returns a pointer to a string describing the */
- X/* user terminal. */
- X/****************************************************************/
- X
- Xchar *longname()
- X {
- X return("IBM_PC_BIOS");
- X }/* longname */
- END_OF_longname.c
- if test 1265 -ne `wc -c <longname.c`; then
- echo \"longname.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f MANIFEST -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"MANIFEST\"
- else
- echo Extracting - \"MANIFEST\"
- sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X attrib.c 2
- X beep.c 1
- X bllibc.cmd 1
- X border.c 2
- X boxes.c 2
- X charadd.c 3
- X chardel.c 2
- X charget.c 4
- X charins.c 3
- X charpick.c 1
- X clrtobot.c 2
- X clrtoeol.c 2
- X curses.3 6
- X curses.cmd 1
- X curses.h 5
- X curses68.c 3
- X curses68.cmd 1
- X cursesio.asm 4
- X curspriv.h 2
- X endwin.c 1
- X farcall.inc 1
- X hugedata.inc 1
- X initscr.c 1
- X linedel.c 2
- X lineins.c 2
- X longname.c 1
- X make.man 3
- X make.uu 7
- X makefile.68 4
- X makefile.msc 5
- X makefile.trc 5
- X MANIFEST 1
- X move.c 1
- X mvcursor.c 1
- X nearcall.inc 1
- X newwin.c 3
- X options.c 2
- X overlay.c 3
- X prntscan.c 4
- X readme.now 6
- X refresh.c 2
- X scrreg.c 1
- X setmode.c 2
- X setterm.c 2
- X smaldata.inc 1
- X stradd.c 1
- X strget.c 3
- X tabsize.c 1
- X termmisc.c 1
- X unctrl.c 1
- X update.c 4
- X winclear.c 1
- X windel.c 1
- X winerase.c 1
- X winmove.c 1
- X winscrol.c 1
- X wintouch.c 1
- END_OF_MANIFEST
- if test 1822 -ne `wc -c <MANIFEST`; then
- echo \"MANIFEST\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f move.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"move.c\"
- else
- echo Extracting - \"move.c\"
- sed "s/^X//" >move.c <<'END_OF_move.c'
- X/****************************************************************/
- X/* Wmove() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_move_rcsid[] = "@(#)move.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Wmove() moves the cursor in window 'win' to position (x,y). */
- X/****************************************************************/
- X
- Xint wmove(win,y,x)
- X WINDOW *win;
- X int y;
- X int x;
- X {
- X if ((x < 0)||(x >= win->_maxx)||(y < win->_regtop)||(y > win->_regbottom))
- X return(ERR);
- X win->_curx = x;
- X win->_cury = y;
- X return(OK);
- X } /* wmove */
- X
- X/****************************************************************/
- X/* Move() moves the cursor in stdscr to position (x,y). */
- X/****************************************************************/
- X
- Xint move(y,x)
- X int y;
- X int x;
- X {
- X return(wmove(stdscr,y,x));
- X } /* move */
- END_OF_move.c
- if test 1682 -ne `wc -c <move.c`; then
- echo \"move.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f mvcursor.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"mvcursor.c\"
- else
- echo Extracting - \"mvcursor.c\"
- sed "s/^X//" >mvcursor.c <<'END_OF_mvcursor.c'
- X/****************************************************************/
- X/* Mvcur() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Changed call sequqnce to cursesio.[c,asm], Thanks */
- X/* to S. Creps. Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_mvcursor_rcsid[] = "@(#)mvcursor.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Mvcur(oldy,oldx,newy,newx) the display cursor to <newy,newx> */
- X/* [ NOTE: Compiler may warn that oldx and oldy are not used ] *.
- X/****************************************************************/
- X
- Xint mvcur(oldy,oldx,newy,newx)
- X int oldy;
- X int oldx;
- X int newy;
- X int newx;
- X {
- X if ((newy >= LINES) || (newx >= COLS) || (newy < 0) || (newx < 0))
- X return(ERR);
- X _cursescursor(newy,newx);
- X _cursvar.cursrow = newy;
- X _cursvar.curscol = newx;
- X return(OK);
- X } /* mvcur */
- END_OF_mvcursor.c
- if test 1593 -ne `wc -c <mvcursor.c`; then
- echo \"mvcursor.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f nearcall.inc -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"nearcall.inc\"
- else
- echo Extracting - \"nearcall.inc\"
- sed "s/^X//" >nearcall.inc <<'END_OF_nearcall.inc'
- X far_call EQU 0
- END_OF_nearcall.inc
- if test 16 -ne `wc -c <nearcall.inc`; then
- echo \"nearcall.inc\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f scrreg.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"scrreg.c\"
- else
- echo Extracting - \"scrreg.c\"
- sed "s/^X//" >scrreg.c <<'END_OF_scrreg.c'
- X/****************************************************************/
- X/* Wsetscrreg() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_scrreg_rcsid[] = "@(#)scrreg.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Wsetscrreg() set the scrolling region of window 'win' to in- */
- X/* clude all lines between 'top' and 'bottom'. */
- X/****************************************************************/
- X
- Xint wsetscrreg(win, top, bottom)
- X WINDOW *win;
- X int top;
- X int bottom;
- X {
- X if ( (0 <= top)
- X &&
- X (top <= win->_cury)
- X &&
- X (win->_cury <= bottom)
- X &&
- X (bottom < win->_maxy)
- X )
- X {
- X win->_regtop = top;
- X win->_regbottom = bottom;
- X return(OK);
- X } /* if */
- X else
- X return(ERR);
- X } /* wsetscrreg */
- X
- X/****************************************************************/
- X/* Setscrreg() set the scrolling region of stdscr to include */
- X/* all lines between 'top' and 'bottom'. */
- X/****************************************************************/
- X
- Xint setscrreg(top, bottom)
- X int top;
- X int bottom;
- X {
- X return(wsetscrreg(stdscr,top,bottom));
- X } /* setscrreg */
- END_OF_scrreg.c
- if test 1932 -ne `wc -c <scrreg.c`; then
- echo \"scrreg.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f smaldata.inc -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"smaldata.inc\"
- else
- echo Extracting - \"smaldata.inc\"
- sed "s/^X//" >smaldata.inc <<'END_OF_smaldata.inc'
- X huge_data EQU 0
- END_OF_smaldata.inc
- if test 17 -ne `wc -c <smaldata.inc`; then
- echo \"smaldata.inc\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f stradd.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"stradd.c\"
- else
- echo Extracting - \"stradd.c\"
- sed "s/^X//" >stradd.c <<'END_OF_stradd.c'
- X/****************************************************************/
- X/* Addstr() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_stradd_rcsid[] = "@(#)stradd.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Waddstr() inserts string 'str' at the current cursor posi- */
- X/* tion in window 'win', and takes any actions as dictated by */
- X/* the characters. */
- X/****************************************************************/
- X
- Xint waddstr(win, str)
- X WINDOW *win;
- X char *str;
- X {
- X while (*str)
- X {
- X if (waddch(win, *str++) == ERR)
- X return(ERR);
- X }
- X return(OK);
- X } /* waddstr */
- X
- X/****************************************************************/
- X/* Addstr() inserts string 'str' at the current cursor posi- */
- X/* tion in stdscr, and takes any actions as dictated by the */
- X/* characters. */
- X/****************************************************************/
- X
- Xint addstr(str)
- X char *str;
- X {
- X return (waddstr(stdscr,str));
- X } /* addstr */
- X
- X/****************************************************************/
- X/* Mvaddstr() move to a new position in stdscr, then inserts */
- X/* string 'str' at the new position, taking any actions as dic- */
- X/* tated by the characters. */
- X/****************************************************************/
- X
- Xint mvaddstr(y,x,str)
- X int y;
- X int x;
- X char *str;
- X {
- X if (wmove(stdscr,y,x) == ERR)
- X return (ERR);
- X return (waddstr(stdscr,str));
- X } /* mvaddstr */
- X
- X/****************************************************************/
- X/* Mvwaddstr() move to a new position in window 'win', then */
- X/* inserts string 'str' at the new position, taking any actions */
- X/* as dictated by the characters. */
- X/****************************************************************/
- X
- Xint mvwaddstr(win,y,x,str)
- X WINDOW *win;
- X int y;
- X int x;
- X char *str;
- X {
- X if (wmove(win,y,x) == ERR)
- X return (ERR);
- X return (waddstr(win,str));
- X } /* mvwaddstr */
- END_OF_stradd.c
- if test 2754 -ne `wc -c <stradd.c`; then
- echo \"stradd.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f tabsize.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"tabsize.c\"
- else
- echo Extracting - \"tabsize.c\"
- sed "s/^X//" >tabsize.c <<'END_OF_tabsize.c'
- X/****************************************************************/
- X/* Tabsize() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_tabsize_rcsid[] = "@(#)tabsize.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Wtabsize(win,ts) sets the tabsize of window 'win' to 'ts', */
- X/* and returns the original value. */
- X/****************************************************************/
- X
- Xint wtabsize(win,ts)
- X WINDOW *win;
- X int ts;
- X {
- X short origval;
- X
- X origval = win->_tabsize;
- X win->_tabsize = ts;
- X return(origval);
- X } /* wtabsize*/
- X
- X/****************************************************************/
- X/* Tabsize(ts) sets the tabsize of stdscr to 'ts', and returns */
- X/* the original value. */
- X/****************************************************************/
- X
- Xint tabsize(ts)
- X int ts;
- X {
- X short origval;
- X
- X origval = stdscr->_tabsize;
- X stdscr->_tabsize = ts;
- X return(origval);
- X } /* tabsize */
- END_OF_tabsize.c
- if test 1752 -ne `wc -c <tabsize.c`; then
- echo \"tabsize.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f termmisc.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"termmisc.c\"
- else
- echo Extracting - \"termmisc.c\"
- sed "s/^X//" >termmisc.c <<'END_OF_termmisc.c'
- X/****************************************************************/
- X/* Miscellaneous Terminal routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- X/* static variables or saving terminal modes */
- X
- Xchar _curses_termmisc_rcsid[] = "@(#)termmisc.c v.1.4 - 900114";
- X
- Xstatic bool savedacr;
- Xstatic bool savedcbr;
- Xstatic bool savedecho;
- Xstatic bool savedraw;
- X
- X/****************************************************************/
- X/* Fixterm(), resetterm(), saveoldterm, saveterm() gettmode(), */
- X/* setterm() and baudrate() function dummies for compatibility. */
- X/****************************************************************/
- X
- Xint fixterm()
- X {
- X return(OK);
- X } /* fixterm */
- X
- Xint resetterm()
- X {
- X return(OK);
- X }
- X
- Xint saveoldterm()
- X {
- X return(OK);
- X } /* saveoldterm */
- X
- Xint saveterm()
- X {
- X return(OK);
- X } /* saveterm */
- X
- Xint gettmode()
- X {
- X return(OK);
- X } /* gettmode */
- X
- Xint setterm()
- X {
- X return(OK);
- X } /* setterm */
- X
- Xint baudrate()
- X {
- X return(19200);
- X } /* baudrate */
- X
- X/****************************************************************/
- X/* Erasechar(), killchar() returns std MSDOS erase chars. */
- X/****************************************************************/
- X
- Xint erasechar()
- X {
- X return(_DCCHAR); /* character delete char */
- X } /* erasechar */
- X
- Xint killchar()
- X {
- X return(_DLCHAR); /* line delete char */
- X } /* killchar */
- X
- X/****************************************************************/
- X/* Savetty() and resetty() saves and restores the terminal I/O */
- X/* settings. */
- X/****************************************************************/
- X
- Xint savetty()
- X {
- X savedacr = _cursvar.autocr;
- X savedcbr = _cursvar.cbreak;
- X savedecho = _cursvar.echo;
- X savedraw = _cursvar.raw;
- X return(OK);
- X } /* savetty */
- X
- Xint resetty()
- X {
- X _cursvar.autocr = savedacr;
- X _cursvar.cbreak = savedcbr;
- X _cursvar.echo = savedecho;
- X _cursvar.raw = savedraw;
- X return(OK);
- X } /* resetty */
- X
- X/****************************************************************/
- X/* Setupterm() sets up the terminal. On a PC, it is always suc- */
- X/* cessful, and returns 1. */
- X/****************************************************************/
- X
- Xint setupterm()
- X {
- X return(1);
- X } /* setupterm */
- END_OF_termmisc.c
- if test 2979 -ne `wc -c <termmisc.c`; then
- echo \"termmisc.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f unctrl.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"unctrl.c\"
- else
- echo Extracting - \"unctrl.c\"
- sed "s/^X//" >unctrl.c <<'END_OF_unctrl.c'
- X/****************************************************************/
- X/* Unctrl() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* IMPLEMENTATION NOTE */
- X/* The conversion from a control character to a two-character */
- X/* sequence is done by the unctrl() function. In the BSD ver- */
- X/* sion of curses it is done by a macro, which uses a publi- */
- X/* cally available translation table. Some ill-behaved appli- */
- X/* cation programs use the table directly, and since it does */
- X/* not exist in this curses version such application will link */
- X/* with an error message complainting about undefined symbols. */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements. Fix for character signed-ness */
- X/* and 8-bit ASCII: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xstatic char strbuf[3] = {0,0,0};
- X
- Xchar _curses_unctrl_rcsid[] = "@(#)unctrl.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Unctrl() returns a char pointer to a string corresponding to */
- X/* argument character 'c'. */
- X/****************************************************************/
- X
- Xchar *unctrl(c)
- X char c;
- X {
- X short ic = c;
- X ic &= 0xff;
- X
- X if (((ic & 0xe0) != 0) && (ic != 0x7f)) /* normal characters */
- X {
- X strbuf[0] = (char) ic;
- X strbuf[1] = '\0';
- X return(strbuf);
- X } /* if */
- X strbuf[0] = '^'; /* '^' prefix */
- X if (c == 0x7f) /* DEL */
- X strbuf[1] = '?';
- X else /* other control */
- X strbuf[1] = ((char) ic) + '@';
- X return(strbuf);
- X } /* unctrl */
- END_OF_unctrl.c
- if test 2266 -ne `wc -c <unctrl.c`; then
- echo \"unctrl.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f winclear.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"winclear.c\"
- else
- echo Extracting - \"winclear.c\"
- sed "s/^X//" >winclear.c <<'END_OF_winclear.c'
- X/****************************************************************/
- X/* Clear() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winclear_rcsid[] = "@(#)winclear.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Wclear() fills all lines of window 'win' with blanks, and */
- X/* marks the window to be cleared at next refresh operation. */
- X/****************************************************************/
- X
- Xvoid wclear(win)
- X WINDOW *win;
- X {
- X werase(win);
- X win->_clear = TRUE;
- X } /* wclear */
- X
- X/****************************************************************/
- X/* Clear() fills all lines of stdscr with blanks, and marks */
- X/* marks sdtscr to be cleared at next refresh operation. */
- X/****************************************************************/
- X
- Xvoid clear()
- X {
- X werase(stdscr);
- X stdscr->_clear = TRUE;
- X } /* clear */
- END_OF_winclear.c
- if test 1664 -ne `wc -c <winclear.c`; then
- echo \"winclear.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f windel.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"windel.c\"
- else
- echo Extracting - \"windel.c\"
- sed "s/^X//" >windel.c <<'END_OF_windel.c'
- X/****************************************************************/
- X/* Delwin() routine of the PCcurses package. */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_windel_rcsid[] = "@(#)windel.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Delwin() deallocates all data allocated by 'win'. If 'win' */
- X/* is a subwindow, it uses the original window's lines for sto- */
- X/* rage, and thus the line arrays are not deallocated. */
- X/****************************************************************/
- X
- Xvoid delwin(win)
- X WINDOW *win;
- X {
- X short i;
- X
- X if (! (win->_flags & _SUBWIN)) /* subwindow uses 'parent's' lines */
- X {
- X for (i = 0; i < win->_maxy && win->_line[i]; i++)
- X free(win->_line[i]);
- X }
- X free(win->_minchng);
- X free(win->_maxchng);
- X free(win->_line);
- X free(win);
- X } /* delwin */
- END_OF_windel.c
- if test 1625 -ne `wc -c <windel.c`; then
- echo \"windel.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f winerase.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"winerase.c\"
- else
- echo Extracting - \"winerase.c\"
- sed "s/^X//" >winerase.c <<'END_OF_winerase.c'
- X/****************************************************************/
- X/* */
- X/* Erase() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winerase_rcsid[] = "@(#)winerase.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Werase() fills all lines of window 'win' with blanks and po- */
- X/* sitions the cursor at home in the scroll region. */
- X/****************************************************************/
- X
- Xvoid werase(win)
- X WINDOW *win;
- X {
- X short *end;
- X short *start;
- X short y;
- X static short blank;
- X
- X blank = ' ' | (win->_attrs & ATR_MSK);
- X
- X for (y = win->_regtop; y <= win->_regbottom; y++) /* clear all lines */
- X {
- X start = win->_line[y];
- X end = &start[win->_maxx - 1];
- X while (start <= end) /* clear all line */
- X *start++ = blank;
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = win->_maxx - 1;
- X }
- X win->_cury = win->_regtop; /* cursor home */
- X win->_curx = 0;
- X } /* werase */
- X
- X/****************************************************************/
- X/* Erase() fills all lines of stdscr with blanks and positions */
- X/* the cursor at home in the scroll region. */
- X/****************************************************************/
- X
- Xvoid erase()
- X {
- X werase(stdscr);
- X } /* erase */
- END_OF_winerase.c
- if test 2082 -ne `wc -c <winerase.c`; then
- echo \"winerase.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f winmove.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"winmove.c\"
- else
- echo Extracting - \"winmove.c\"
- sed "s/^X//" >winmove.c <<'END_OF_winmove.c'
- X/****************************************************************/
- X/* Mvwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winmove_rcsid[] = "@(#)winmove.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Mvwin() moves window 'win' to position (begx, begy) on the */
- X/* screen. */
- X/****************************************************************/
- X
- Xint mvwin(win, begy, begx)
- X WINDOW *win;
- X int begy, begx;
- X {
- X if ((begy + win->_maxy) >= (LINES-1) || (begx + win->_maxx) > (COLS-1))
- X return(ERR);
- X win->_begy = begy;
- X win->_begx = begx;
- X touchwin(win);
- X return(OK);
- X } /* mvwin */
- END_OF_winmove.c
- if test 1454 -ne `wc -c <winmove.c`; then
- echo \"winmove.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f winscrol.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"winscrol.c\"
- else
- echo Extracting - \"winscrol.c\"
- sed "s/^X//" >winscrol.c <<'END_OF_winscrol.c'
- X/****************************************************************/
- X/* Scroll() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winscrol_rcsid[] = "@(#)winscrol.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Scroll() scrolls the scrolling region of 'win', but only if */
- X/* scrolling is allowed and if the cursor is inside the scrol- */
- X/* ling region. */
- X/****************************************************************/
- X
- Xvoid scroll(win)
- X WINDOW *win;
- X {
- X short i;
- X short *ptr;
- X short *temp;
- X static short blank;
- X
- X blank = ' ' | (win->_attrs & ATR_MSK);
- X if ( (!win->_scroll) /* check if window scrolls */
- X || (win->_cury < win->_regtop) /* and cursor in region */
- X || (win->_cury > win->_regbottom)
- X )
- X return;
- X
- X temp = win->_line[win->_regtop];
- X for (i = win->_regtop; i < win->_regbottom; i++)
- X {
- X win->_line[i] = win->_line[i+1]; /* re-arrange line pointers */
- X win->_minchng[i] = 0;
- X win->_maxchng[i] = win->_maxx - 1;
- X }
- X for (ptr = temp; ptr - temp < win->_maxx; ptr++)
- X *ptr = blank; /* make a blank line */
- X win->_line[win->_regbottom] = temp;
- X if (win->_cury > win->_regtop) /* if not on top line */
- X win->_cury--; /* cursor scrolls too */
- X win->_minchng[win->_regbottom] = 0;
- X win->_maxchng[win->_regbottom] = win->_maxx - 1;
- X } /* scroll */
- END_OF_winscrol.c
- if test 2186 -ne `wc -c <winscrol.c`; then
- echo \"winscrol.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f wintouch.c -a "${1}" != "-c" ; then
- echo Will not over-write existing file \"wintouch.c\"
- else
- echo Extracting - \"wintouch.c\"
- sed "s/^X//" >wintouch.c <<'END_OF_wintouch.c'
- X/****************************************************************/
- X/* Touchwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (bl@infovox.se) */
- X/****************************************************************/
- X/* 1.4: Use of short wherever possible. Portability */
- X/* improvements: 900114 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.0: Release: 870515 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_wintouch_rcsid[] = "@(#)wintouch.c v.1.4 - 900114";
- X
- X/****************************************************************/
- X/* Touchwin() marks all lines of window 'win' as changed, from */
- X/* the first to the last character on the line. */
- X/****************************************************************/
- X
- Xvoid touchwin(win)
- X WINDOW *win;
- X {
- X short y;
- X short maxy;
- X short maxx;
- X
- X maxy = win->_maxy - 1;
- X maxx = win->_maxx - 1;
- X
- X for (y = 0; y <= maxy; y++)
- X {
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = maxx;
- X } /* for */
- X } /* touchwin */
- END_OF_wintouch.c
- if test 1501 -ne `wc -c <wintouch.c`; then
- echo \"wintouch.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo End of archive 1 \(of 7\).
- cp /dev/null archdone.1
- MISSING=""
- for I in 1 2 3 4 5 6 7 ; do
- if test ! -f archdone.${I} ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 7 archives.
- rm -f archdone.[1-9]
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
-